<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var obj = {
            name: '张美丽'
        };
        var newObj = {
            name: '王一茗',
            age: 20,
            sayHi: function() {
                console.log('你好');
            }
        };

        // Object.create():使用现有对象来提供新创建对象的__proto__
        var rel1Obj = Object.create(obj);
        var rel2Obj = Object.create(newObj, {
            sex: {
                value: '男',
                configurable: true,
                enumerable: true,
                writable: true
            }
        });
        console.log(rel1Obj);
        console.log(rel2Obj);
    </script>
</body>

</html>